﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.IO;
using MoonLight.LibCommon;
using Autumn.Common;
using Autumn.Business;

namespace Autumn
{
    public partial class ServiceStart : ServiceBase
    {
        public ServiceStart()
        {
            InitializeComponent();
            m_svr_kernel = new SvrKernel();
        }

        protected override void OnStart(string[] args)
        {
            string path = ProjectDefine.SeverInfo.log_path;
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            Logger.SetLogPath(path);

            m_svr_kernel.Run();
        }

        protected override void OnStop()
        {
            m_svr_kernel.Stop();
            Logger.CloseLog();
        }

        private SvrKernel m_svr_kernel;
    }
}
